<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后续回访记录</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<script type="text/javascript">
	var grid = null;
	$(function () {
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/audit/audVisitRecord/initPageList.do',
	    	method : 'get',
	    	parms:{
	        	visitTypeCd:AuditConstant.AUD_VISIT_TYP_CD_FLOW,
	        	flag:1
	        },
	        columns: [
	            { display: '承租人', name: 'tenantNm', minWidth: 150},
	            { display: '回访次数', name: 'times', minWidth: 150},
	            { display: '回访人员类型', name: 'personnelTypeCdNm', minWidth: 150},
	            { display: '回访人员姓名', name: 'personnelName', minWidth: 150},
	            { display: '客户经理', name: 'accountManagerNm', minWidth: 150},
	            { display: '信审员', name: 'auditorNm', minWidth: 150},
	            { display: '回访时间', name: 'visitTm', minWidth: 140, 
	            	render:function (rowdata, index, value){
	            		var dateStr = "";
	            		if(StringUtils.isNotEmpty(value)){
	            			var date = new Date(value);
	            			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
	            		}
	            		return dateStr;
	            	}
	            },
	            { display: '电话号码', name: 'phone', minWidth: 150},
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'95%',
	        heightDiff:-2,
	        checkbox:true,
	        rownumbers:true,
	        onAfterShowData: function () {
	            $(".gridTip").grid_ligerTip();
	            SetIframe_height ();
	        }
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	         if($("#crtStartDt").val()>$("#crtEndDt").val()){
	        	 $.ligerDialog.SQalert({content: "回访日期(起)不能大于回访日期(止)" , SQ_type: "warning" });
	        	 return;
	         }
            var date1 = new Date();
            date1.setFullYear(date1.getFullYear()-1);
            date1.setDate(date1.getDate() + 1);
            if (StringUtils.isEmpty($("#personnelName").val())) {
                if (StringUtils.isEmpty($("#crtStartDt").val())){
                    grid.setParm("crtStartDt",DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD));
                }
                var flag = false;
                if (StringUtils.isNotEmpty($("#crtStartDt").val()) && $("#crtStartDt").val() < DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD)){
                    flag = true;
                }
                if (StringUtils.isNotEmpty($("#crtEndDt").val()) && $("#crtEndDt").val() < DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD)){
                    flag = true;
                }
                if (flag){
                    top.$.ligerDialog.SQalert({content: "仅可查询回访日期至今一年内数据",SQ_type: "success"});
                    grid.setParm("crtStartDt",DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD));
                }
            }
	         grid.reload();
	    });
	    $("#clearBtn").click(function(event) {
	        $("#resetBtn").click();  //重置 input-text
	        var form = liger.get("searchBar");
	    });
	    
	    $("#pageloading").hide();
	    
	});
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
</script>

<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox">
                <div class="label">回访人员姓名</div>
                <div class="field">
                    <input name="personnelName" id="personnelName" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">客户经理</div>
                <div class="field">
                    <input name="accountManagerNm" id="accountManagerNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">信审员</div>
                <div class="field">
                    <input name="auditorNm" id="auditorNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">回访日期</div>
                <div class="field">
                    <input name="crtStartDt" id="crtStartDt" type="text" class="ui-datepicker" value="" >
                     - 
                    <input name="crtEndDt" id="crtEndDt" type="text" class="ui-datepicker" value="" >
                </div>
            </div>
            <div class="clearFix"></div>
            <div class="btnsBox formBtns notRight">
                <span id="searchBtn" class="sq-button-round">查询</span>
                <span id="clearBtn" class="sq-button-round">清空</span>
                <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
            </div>
        </div>
      </form>
    </div>
    <div class="sqPanel" style="margin-bottom: 0;">
        <div class="sqPanel_head" style="float:left;color: red">
            <table class="table_full">
                <tr>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><i class="ico_flasher"></i></b>仅支持近一年内的数据查询
                    </td>
                </tr>
            </table>
        </div>
        <div id="ligergrid1" class="sq-grid"></div>
    </div>
</div>


</body>
</html>